let residentInfo = [
    {
        id: 1001,
        residentName: '王然',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                color: 'rgba(250, 116, 107, 0.0980392156862745)',
                value: "高血压",
            },
            {
                type: '',
                color: 'rgba(108, 118, 244, 0.0980392156862745)',
                value: '冠心病',
            },
            {
                type: 'warning',
                color: 'rgba(253, 219, 120, 0.0980392156862745)',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    },
    {
        id: 1002,
        residentName: '王然他爹',
        avator: '',
        Age: 54,
        idnum: "380906499721025519",
        tel: 12345678857,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [001]
    }, {
        id: 003,
        residentName: '王然3',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    }, {
        id: 004,
        residentName: '王然4',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    }, {
        id: 005,
        residentName: '王然5',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    }, {
        id: 006,
        residentName: '王然6',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    }, {
        id: 007,
        residentName: '王然7',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    }, {
        id: 0010,
        residentName: '王然10',
        avator: '',
        Age: 24,
        idnum: "380906499721025519",
        tel: 12345678978,
        signStatus: '签约中',
        tage: [
            {
                type: 'danger',
                value: "高血压",
            },
            {
                type: '',
                value: '冠心病',
            },
            {
                type: 'warning',
                value: '高血糖'
            }
        ],
        residentStatus: true,
        location: '原话路',
        password: '123',
        excutedArea: '青羊区',
        sex: '男',
        brithday: '1998-09-02',
        from: '背景',
        race: '汉族',
        education: '本科',
        marriage: '已婚',

        healthInfo: {
            heigth: "195",
            weigth: "80",
            bloodtype: "A",
            RH: '是',
            allergy: false,
            history: false,
            before: false,
            familyHistory: false
        },
        familyMemberId: [002]
    },
]

let healthInfoList = [
    {
        id: 1001,
        info: [
            {
                date: '2022-05-03',
                value: 49.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-06-03',
                value: 49.0,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-07-03',
                value: 50.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-08-03',
                value: 48,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-09-03',
                value: 46.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-10-03',
                value: 47.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-11-03',
                value: 49.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-12-03',
                value: 48,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2023-05-03',
                value: 48.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2024-05-03',
                value: 48,
                test: '正常',
                source: '用户记录'
            },
        ]
    },
    {
        id: 1002,
        info: [
            {
                date: '2016-08-03',
                value: 89.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-08-03',
                value: 89.0,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 50.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 88,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 86.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 87.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 89.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 88,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 88.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 88,
                test: '正常',
                source: '用户记录'
            },
        ]
    },



]
let bloodSugerBeforeMeelInfoList = [
    {
        id: 1001,
        info: [
            {
                date: '2022-05-03',
                value: 4.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-06-03',
                value: 4.0,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-07-03',
                value: 5.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-08-03',
                value: 4,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-09-03',
                value: 4.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-10-03',
                value: 4.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-11-03',
                value: 4.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-12-03',
                value: 4,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2023-05-03',
                value: 4.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2024-05-03',
                value: 4,
                test: '正常',
                source: '用户记录'
            },
        ]
    },
    {
        id: 1002,
        info: [
            {
                date: '2016-08-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-08-03',
                value: 8.0,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 5.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8,
                test: '正常',
                source: '用户记录'
            },
        ]
    },



]
let bloodPresureInfoList = [
    {
        id: 1001,
        info: [
            {
                date: '2022-05-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-06-03',
                value: '85 / 130',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-07-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-08-03',
                value: '86 / 130',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-09-03',
                value: '85 / 123',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-10-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-11-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            }
        ]
    },
    {
        id: 1002,
        info: [
            {
                date: '2016-08-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-08-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: '88 / 122',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: '80 / 120',
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: '80 / 129',
                test: '正常',
                source: '用户记录'
            }
        ]
    },



]
let heartRateInfoList = [
    {
        id: 1001,
        info: [
            {
                date: '2022-05-03',
                value: 49,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-06-03',
                value: 60,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-07-03',
                value: 70,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-08-03',
                value: 68,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-09-03',
                value: 66,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-10-03',
                value: 60,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-11-03',
                value: 65,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-12-03',
                value: 70,
                test: '正常',
                source: '用户记录'
            }
        ]
    },
    {
        id: 1002,
        info: [
            {
                date: '2016-08-03',
                value: 89,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-08-03',
                value: 89,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 88,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 70,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 75,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 60,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 77,
                test: '正常',
                source: '用户记录'
            }
        ]
    },



]
let bloodSugerAfterMeelInfoList = [
    {
        id: 1001,
        info: [
            {
                date: '2022-05-03',
                value: 6.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-06-03',
                value: 6.0,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-07-03',
                value: 6.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-08-03',
                value: 6,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-09-03',
                value: 6.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-10-03',
                value: 6.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-11-03',
                value: 6.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2022-12-03',
                value: 6,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2023-05-03',
                value: 6.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2024-05-03',
                value: 6,
                test: '正常',
                source: '用户记录'
            },
        ]
    },
    {
        id: 1002,
        info: [
            {
                date: '2016-08-03',
                value: 8.5,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-08-03',
                value: 8.0,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 6,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.2,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.8,
                test: '正常',
                source: '用户记录'
            },
            {
                date: '2016-05-03',
                value: 8.8,
                test: '正常',
                source: '用户记录'
            },
        ]
    },



]
const residentController = {
    getAllResidentInfo(req, res) {
        res.send(residentInfo)
    },
    getHealthRecordById(req, res) {
        let info = healthInfoList.find(item => {
            return item.id == req.body.id
        })
        if (info) {
            res.send(info.info)
        } else {
            res.status(404),
                res.send('没有找到该用户的信息')
        }
    },
    getAllHealthRecordById(req, res) {
        let weight = healthInfoList.find(item => {
            return item.id == req.body.id
        })
        let sugerbefore = bloodSugerBeforeMeelInfoList.find(item => {
            return item.id == req.body.id
        })
        let sugerafter = bloodSugerAfterMeelInfoList.find(item => {
            return item.id == req.body.id
        })
        let bloodpresure = bloodPresureInfoList.find(item => {
            return item.id == req.body.id
        })
        let heartrate = heartRateInfoList.find(item => {
            return item.id == req.body.id
        })
        if (weight && sugerafter && sugerbefore && bloodpresure && heartrate) {
            res.send([weight.info, sugerbefore.info, sugerafter.info, bloodpresure.info, heartrate.info])
        } else {
            res.status(404),
                res.send('没有找到该用户的信息')
        }
    },
    deleteData(req, res) {
        console.log(req.body.data);

        res.send(JSON.stringify(req.body.data) + '已被删除')
    }


}
module.exports = { residentController }
